package com.itheima.controller;

import com.itheima.exception.SystemException;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.sql.SQLException;

@Controller
@RequestMapping("/exception")
public class ExceptionController {

    @RequestMapping("/test01")
    public String test01(){
        try{
          throw  new SQLException();
        }catch (SQLException e){
            throw new SystemException("数据库连接超时",e);
        }
    }
}
